#include "Deck.h"
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include "Card.h"
#include <string.h>
#include "Player.h"

//flower[0]=heart , flower[1]=diamond , flower[2]=club , flower[3]=spade




int Deck::a=0;

Deck::Deck()
{

    for (int i=0;i<4;i++)
    {
         for (int j=0;j<13;j++)
         {
              cards[i*13+j].flower = i;
              cards[i*13+j].number = j;
         }
    }
    flowers[0]=3;
    flowers[1]=4;
    flowers[2]=5;
    flowers[3]=6;
    numbers[0]="A";
    numbers[1]="2";
    numbers[2]="3";
    numbers[3]="4";
    numbers[4]="5";
    numbers[5]="6";
    numbers[6]="7";
    numbers[7]="8";
    numbers[8]="9";
    numbers[9]="10";
    numbers[10]="J";
    numbers[11]="Q";
    numbers[12]="K";
}


void Deck::shuffle()
{
    Card temp;
    for (int i=0;i<4;i++)
    {
         for (int j=0;j<13;j++)
         {
              cards[i*13+j].flower = i;
              cards[i*13+j].number = j+1;
         }
    }
    cout << "Shuffle the cards..." << endl << endl;
    for (int i=0;i<52;i++)
    {
         int x = rand() % 52;
         temp = cards[i];
         cards[i] = cards[x];
         cards[x] = temp;
    }
}

void Deck::DealTable(int no)
{
    Table[no] = cards[a];
    a = a+1;


}

void Deck::PrintTable()
{
    for(int i=0;i<5;i++)
    {
        cout << endl;
        cout << Table[i] ;
     }
     cout << endl;
     cout << endl;


}

